package tests;

import java.util.ArrayList;

import common.Coordinate;
import common.Player;
import common.Tile;
import common.enumCompany;


import junit.framework.TestCase;

public class PlayerTest extends TestCase{
    Player player;
    enumCompany comp;
    Tile tile;
    ArrayList<Tile> emptytiles;
    ArrayList<Tile> onetile;
    
    protected void setUp() {
        player = new Player("oded", null); 
        comp = enumCompany.QUANTUM;
        tile = new Tile(new Coordinate(5,5));
        emptytiles = new ArrayList<Tile>();
        onetile = new ArrayList<Tile>(); 
        onetile.add(tile);
        
    }
    
    public void testgetCash() {
        assertEquals(0, player.getCash());
    }
    
    public void testincreaseCash() {
    	player.increaseCash(200);
        assertEquals(200, player.getCash());
    }

    public void testdecreaseCash(int money) {
    	player.increaseCash(200);
    	player.decreaseCash(100);
    	assertEquals(100, player.getCash());
    }

    public void testgetName() {
       assertEquals("oded",player.getName());
    }

    public void testgetCompanyStocks() {
    	assertEquals(0, player.getCompanyStocks(comp));
    }

    public void testincreaseCompanyStock() {
    	player.increaseCompanyStock(comp, 3);
    	assertEquals(3, player.getCompanyStocks(comp));
    }

    public void testdecreaseCompanyStock() {
    	player.increaseCompanyStock(comp, 3);
    	player.decreaseCompanyStock(comp, 2);
    	assertEquals(1, player.getCompanyStocks(comp));
    }

    public void testremoveTile() {
    	player.addTile(tile);
    	player.removeTile(tile);
    	assertEquals(emptytiles, player.getTiles());
    
    }

    public void testaddTile() {
        player.addTile(tile);
        assertEquals(onetile, player.getTiles());
    }
    protected void tearDown() {}
   
    
	}



